package com.becca.cake.dao.coupon;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.becca.cake.model.coupon.CouponModel;
import com.becca.cake.model.coupon.CouponSaleSlipModel;

/**
 * 优惠管理数据层接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author hejinguo
 * @date 2016年7月1日 上午9:06:13
 */
@Repository
public interface CouponDAO {
    /**
     *  查询优惠码
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<CouponModel> selectCoupon(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询优惠码总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectCouponCount(Map<String, Object> map) throws DataAccessException;

    /**
     *  查询优惠码状态
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<CouponModel> selectCouponStatus(Map<String, Object> map) throws DataAccessException;

    /**
     * 查询优惠码状态总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectCouponStatusCount(Map<String, Object> map) throws DataAccessException;

    /**
     * 添加优惠码
     * @param couponModel
     * @throws DataAccessException
     */
    void insertCoupon(CouponModel couponModel) throws DataAccessException;

    /**
     * 修改优惠码
     * @param couponModel
     * @throws DataAccessException
     */
    void updateCoupon(CouponModel couponModel) throws DataAccessException;

    /**
     * 根据id查询优惠码对象
     * @param id
     * @return
     * @throws DataAccessException
     */
    CouponModel queryCouponById(Integer id) throws DataAccessException;

    /**
     * 设置优惠码 couponCode
     * @param map
     * @throws DataAccessException
     */
    void updCouponCode(Map<String, Object> map) throws DataAccessException;

    /**
     * 判断优惠码是否存在
     * @param couponModel
     * @return
     * @throws DataAccessException
     */
    Long isCouponCodeExist(CouponModel couponModel) throws DataAccessException;

    /**
     * 优惠码激活
     * @param map
     * @throws DataAccessException
     */
    void updateActivatedCoupon(Map<String, Object> map) throws DataAccessException;

    /**
     *  查询销售数据
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<CouponSaleSlipModel> selectCouponSale(Map<String, Object> map) throws DataAccessException;

    /**
     *  获取销售数据条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectCouponSaleSlipCount(Map<String, Object> map) throws DataAccessException;

    /**
     *  添加销售信息
     * @param couponSaleSlipModel
     * @throws DataAccessException
     */
    void insertCouponSaleSlip(CouponSaleSlipModel couponSaleSlipModel) throws DataAccessException;

    /**
     * 修改销售信息
     * @param couponSaleSlipModel
     * @throws DataAccessException
     */
    void updateCouponSaleSlip(CouponSaleSlipModel couponSaleSlipModel) throws DataAccessException;

    /**
     * 删除销售信息
     * @param id
     * @throws DataAccessException
     */
    void deleteCouponSaleSlipById(Integer id) throws DataAccessException;

    /**
     * 根据id查询销售信息
     * @param couponSaleId
     * @return
     * @throws DataAccessException
     */
    CouponSaleSlipModel selectCouponSaleById(Integer couponSaleId) throws DataAccessException;

    /**
     * 查询优惠码信息
     * @param paramMap
     * @return
     */
    CouponModel selectCouponByCouponCode(Map<String, Object> paramMap);

    /**
     * 修改优惠码状态
     * @param paramMap
     */
    void updateCouponCodeStatus(Map<String, Object> paramMap);

}
